//change to ASCII 

import java.io.*;
import java.util.*;

public class Main{
	public static void main(String[] args){
		try{
			byte[] sim={	(byte)0xBC,(byte)0xF2,
					(byte)0xCC,(byte)0xE5,
					(byte)0xD6,(byte)0xD0,
					(byte)0xCE,(byte)0xC4,
					};

			ByteArrayInputStream bytearrayinputstream=new ByteArrayInputStream(sim);
			InputStreamReader inputstreamreader=new InputStreamReader(bytearrayinputstream,"GB2312");
	
			PrintWriter printwriter=new PrintWriter(new OutputStreamWriter(new FileOutputStream(args[0]),"GB2312"));
			
			int in=0;
			printwriter.print("printwriter:");
			while((in=inputstreamreader.read())!=-1){
				printwriter.print((char)in);
			}
			printwriter.println();

			printwriter.close();


			bytearrayinputstream.close();
			bytearrayinputstream.reset();

			PrintStream printstream=new PrintStream(new FileOutputStream(args[0],true),true,"GB2312");
			printstream.print("printstream:");
			
			while((in=inputstreamreader.read())!=-1){
				printstream.print((char)in);
			}
			printstream.println();

			inputstreamreader.close();
			printstream.close();







		}
		catch(ArrayIndexOutOfBoundsException e){
			e.printStackTrace();
		}
		catch(IOException e){
			e.printStackTrace();
		}
	}
}